package cn.zcscloud.mall.service.impl;


import cn.zcscloud.mall.mbg.mapper.UmsResourceMapper;
import cn.zcscloud.mall.mbg.model.UmsResource;
import cn.zcscloud.mall.mbg.model.UmsRoleResourceRelation;
import cn.zcscloud.mall.service.UmsResourceService;
import cn.zcscloud.mall.service.UmsRoleResourceRelationService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UmsResourceServiceImpl extends ServiceImpl<UmsResourceMapper, UmsResource> implements UmsResourceService {

    @Autowired
    private UmsRoleResourceRelationService umsRoleResourceRelationService;

    @Override
    public void deleteById(Integer id) {
        //删除角色资源关系表
        LambdaQueryWrapper<UmsRoleResourceRelation> lqw = new LambdaQueryWrapper<>();
        lqw.eq(UmsRoleResourceRelation::getResourceId, id);
        umsRoleResourceRelationService.remove(lqw);
//删除资源表
        this.removeById(id);
    }
}
